import 'package:get/get.dart';
import '../../model/chart/chart_menu_item_model/chart_menu_item_model.dart';
import 'bar_chart/bar_chart_view.dart';
import 'chart_state.dart';
import 'line_chart/line_chart_view.dart';
import 'pie_chart/pie_chart_view.dart';
import 'radar_chart/radar_chart_view.dart';
import 'scatter_chart/scatter_chart_view.dart';

class ChartLogic extends GetxController {
  final ChartState state = ChartState();

  @override
  void onInit() {
    var map = Get.arguments;
    state.title = map["title"];
    super.onInit();
  }

  /// item点击事件
  void itemEvent(ChartMenuItemModel itemModel){
    if(itemModel.chartType == ChartType.line){
      // 折线图
      Get.to(()=> LineChartPage(),arguments: {"title": itemModel.text});

    }else if (itemModel.chartType == ChartType.bar){
      // 条形图
      Get.to(()=> BarChartPage(),arguments: {"title": itemModel.text});

    }else if (itemModel.chartType == ChartType.pie){
      // 饼状图
      Get.to(()=> PieChartPage(),arguments: {"title": itemModel.text});

    }else if (itemModel.chartType == ChartType.scatter){
      // 散点图
      Get.to(()=> ScatterChartPage(),arguments: {"title": itemModel.text});

    }else if (itemModel.chartType == ChartType.radar){
      // 雷达图
      Get.to(()=> RadarChartPage(),arguments: {"title": itemModel.text});

    }
  }

}
